<?php

if (!defined('BASEPATH'))
exit('No direct script access allowed');

class Template extends MX_Controller {

	function __construct() {
		parent::__construct();
		$this->load->model('lookupmodel');
		//check is logged in
		$this->load->model('languagemodel');
		$this->language = $this->languagemodel->is_language_using();
		$this->load->helper('MY_url_helper');
		$this->load->library('document');
	}

	public function default_template($data) {
		//Text in the footer
		$this->lang->load('common/header', $this->language);
		$this->lang->load('common/home', $this->language);
		$this->lang->load('common/footer', $this->language);

		$data['footer_text_connect_with_us'] = $this->lang->line('footer_text_connect_with_us');
		$data['footer_text_copyright'] = sprintf($this->lang->line('footer_text_copyright'), base_url() . 'term-of-use.html');
		$data['text_wishlist'] = sprintf('Short List (%s)', ($this->session->userdata('wishlist') ? count($this->session->userdata('wishlist')) : 0));
		
		$data['browser'] = $this->agent->browser();
		$data['version'] = (int) $this->agent->version();
		
		$data['visited'] = false;
		
		if (!$this->session->userdata('visited')) {
			$data['visited'] = true;
			$this->session->set_userdata('visited', TRUE);
		}

		// -- START FACEBOOK COMMENTS META TAGS
		$data['fbmetas'] = $this->document->getFBMetas();
		// -- STOP FACEBOOK COMMENTS META TAGS

		//Navigation
		$data['text_select_country'] = $this->lang->line('text_select_country');
		$data['text_home']	= $this->lang->line('text_home');
		$data['text_projects']	= $this->lang->line('text_projects');
		$data['text_buyer_guide'] = $this->lang->line('text_buyer_guide');
		$data['text_advanced_search'] = $this->lang->line('text_advanced_search');
		$data['text_advanced_search_properties'] = $this->lang->line('text_advanced_search_properties');
		$data['text_advanced_search_local_properties'] = $this->lang->line('text_advanced_search_local_properties');
		$data['text_advanced_search_international_properties'] = $this->lang->line('text_advanced_search_international_properties');
		$data['text_keyword_of_properties'] = $this->lang->line('text_keyword_of_properties');
		$data['text_keyword'] = $this->lang->line('text_keyword');
		$data['text_add_des'] = $this->lang->line('text_add_des');
		$data['text_event_calender'] = $this->lang->line('text_event_calender');
		$data['text_our_service'] = $this->lang->line('text_our_service');
		$data['text_our_team'] = $this->lang->line('text_our_team');
		$data['text_market_information'] = $this->lang->line('text_market_information');
		$data['text_news'] = $this->lang->line('text_news');
		$data['text_research'] = $this->lang->line('text_research');
		$data['text_home_loan'] = $this->lang->line('text_home_loan');
		$data['text_list_your_property'] = $this->lang->line('text_list_your_property');
		$data['text_contact_us'] = $this->lang->line('text_contact_us');

		//Search
		$data['text_properties_search'] = $this->lang->line('text_properties_search');
		$data['text_local'] = $this->lang->line('text_local');
		$data['text_international'] = $this->lang->line('text_international');
		$data['text_please_select'] = $this->lang->line('text_please_select');
		$data['text_property_for'] = $this->lang->line('text_property_for');
		$data['text_resale'] = $this->lang->line('text_resale');
		$data['text_project_listing'] = $this->lang->line('text_project_listing');
		$data['text_refine_search'] = $this->lang->line('text_refine_search');
		$data['text_refine_search'] = $this->lang->line('text_refine_search');
		$data['text_property_forsale'] = $this->lang->line('text_property_forsale');
		$data['text_property_forlease'] = $this->lang->line('text_property_forlease');
		$data['text_property_classification'] = $this->lang->line('text_property_classification');
		$data['text_all_propertytype'] = $this->lang->line('text_all_propertytype');
		$data['text_propertytype'] = $this->lang->line('text_propertytype');
		$data['text_short_propertytype'] = $this->lang->line('text_short_propertytype');
		$data['text_country'] = $this->lang->line('text_country');
		$data['text_singapore'] = $this->lang->line('text_singapore');
		$data['text_all_countries'] = $this->lang->line('text_all_countries');
		$data['text_all_city'] = $this->lang->line('text_all_city');
		$data['text_all_cities'] = $this->lang->line('text_all_cities');
		$data['text_select_city'] = $this->lang->line('text_select_city');
		$data['text_select_location'] = $this->lang->line('text_select_location');
		$data['text_select_subarea'] = $this->lang->line('text_select_subarea');
		$data['text_cities_selected'] = $this->lang->line('text_cities_selected');
		$data['text_location_selected'] = $this->lang->line('text_location_selected');
		$data['text_subarea_selected'] = $this->lang->line('text_subarea_selected');
		$data['text_city'] = $this->lang->line('text_city');
		$data['text_location'] = $this->lang->line('text_location');
		$data['text_subarea'] = $this->lang->line('text_subarea');
		$data['text_all_location'] = $this->lang->line('text_all_location');
		$data['text_all'] = $this->lang->line('text_all');
		$data['text_district'] = $this->lang->line('text_district');
		$data['text_districtLbl'] = $this->lang->line('text_districtLbl');
		$data['text_property_type'] = $this->lang->line('text_property_type');
		$data['text_listingtype'] = $this->lang->line('text_listingtype');
		$data['text_price_from'] = $this->lang->line('text_price_from');
		$data['text_price_to'] = $this->lang->line('text_price_to');
		$data['text_price'] = $this->lang->line('text_price');
		$data['text_size'] = $this->lang->line('text_size');
		$data['text_area'] = $this->lang->line('text_area');
		$data['text_gross'] = $this->lang->line('text_gross');
		$data['text_studio'] = $this->lang->line('text_studio');
		$data['text_bedrooms'] = $this->lang->line('text_bedrooms');
		$data['text_bathrooms'] = $this->lang->line('text_bathrooms');
		$data['text_features'] = $this->lang->line('text_features');
		$data['text_facilities'] = $this->lang->line('text_facilities');
		$data['text_tenure'] = $this->lang->line('text_tenure');
		$data['text_description'] = $this->lang->line('text_lbl_description');
		$data['text_overview'] = $this->lang->line('text_overview');
		$data['text_property_information'] = $this->lang->line('text_property_information');
		$data['text_filter'] = $this->lang->line('text_filter');
		$data['text_search_now'] = $this->lang->line('text_search_now');
		$data['text_search_low'] = $this->lang->line('text_search_low');
		$data['text_search_by_map'] = $this->lang->line('text_search_by_map');
		$data['text_min'] = $this->lang->line('text_min');
		$data['text_max'] = $this->lang->line('text_max');
		$data['text_to'] = $this->lang->line('text_to');
		$data['text_feature_projects'] = $this->lang->line('text_feature_projects');
		$data['text_find_property'] = $this->lang->line('text_find_property');
		$data['text_sort_by'] = $this->lang->line('text_sort_by');
		$data['text_all_tenure'] = $this->lang->line('text_all_tenure');
		$data['text_local_sale'] = $this->lang->line('text_local_sale');
		$data['text_international_sale'] = $this->lang->line('text_international_sale');
		$data['text_land_sale'] = $this->lang->line('text_land_sale');
		$data['text_portal'] = $this->lang->line('text_portal');
		$data['text_submit'] = $this->lang->line('text_submit');
		$data['text_firstname'] = $this->lang->line('text_firstname');
		$data['text_lastname'] = $this->lang->line('text_lastname');
		$data['text_password'] = $this->lang->line('text_password');
		$data['text_email_address'] = $this->lang->line('text_email_address');
		
		//Agency Contact
		$data['text_agency_project_sale'] = $this->lang->line('text_agency_project_sale');
		$data['text_agency_project_sale_number'] = $this->lang->line('text_agency_project_sale_number');
		$data['text_agency_international'] = $this->lang->line('text_agency_international');
		$data['text_agency_international_number'] = $this->lang->line('text_agency_international_number');
		$data['text_agency_leasing'] = $this->lang->line('text_agency_leasing');
		$data['text_agency_leasing_number'] = $this->lang->line('text_agency_leasing_number');
		$data['text_agency_resale'] = $this->lang->line('text_agency_resale');
		$data['text_agency_resale_number'] = $this->lang->line('text_agency_resale_number');
		$data['text_agency_ad'] = $this->lang->line('text_agency_ad');
		$data['text_contact_this_agent_to_schedule_a_meeting'] = $this->lang->line('text_contact_this_agent_to_schedule_a_meeting');
		//End Agency Contact

		$data['dd_country_market'] = $this->lookupmodel->getCountryMarket();
		$data['dd_int_country'] = $this->lookupmodel->getInternationalCountries($this->config->item('config_language_id'), 1);
		$data['lkup_cities'] = $this->lookupmodel->getListCities($this->config->item('config_language_id'), $this->config->item('market'));
		$data['city_id'] = false;
		if($this->config->item('market') == 'SG') {
			if($data['lkup_cities']) {
				$data['city_id'] = $data['lkup_cities'][0]->City_ID;
			}	  	
		}
		
		$data['lkup_location'] = $this->lookupmodel->getListLocation($this->config->item('config_language_id'), $this->config->item('market'));		
		$data['lkup_subarea'] = $this->lookupmodel->getListSubarea($this->config->item('config_language_id'), $this->config->item('market'));
		$data['dd_propertytype'] = $this->lookupmodel->GetPropertyType($this->config->item('config_language_id'), $this->config->item('market'));
		$data['dd_propertycategory'] = $this->lookupmodel->GetPropertyCategory($this->config->item('config_language_id'), $this->config->item('market'));
		$data['feature'] = $this->lookupmodel->GetFeature($this->config->item('config_language_id'));
		$data['facilities'] = $this->lookupmodel->GetFacilities($this->config->item('config_language_id'));
		$data['tenure'] = $this->lookupmodel->getAllTenure($this->config->item('config_language_id'), $this->config->item('market'));
		$data['size'] = $this->lookupmodel->getSize();
		$data['location'] = $this->lookupmodel->GetLocation($this->config->item('config_language_id'));
		$data['disclaimer'] = $this->lookupmodel->getDisclaimer($this->config->item('config_language_id'), $this->config->item('market'));
		//$data['country'] = $this->lookupmodel->GetCountry(1);

		//echo  $this->members->getFirstName(); die();
		$data['logged'] = $this->members->isLogged();
		$data['text_welcome'] = sprintf($this->lang->line('text_welcome'), base_url() . 'member/login', base_url() . 'member/register');
		$data['text_logged'] = sprintf($this->lang->line('text_logged'), base_url() . 'member/dashboard', $this->members->getFirstName(), base_url() . 'member/logout');
		
		//right side banner
		

		$data['redirect'] = full_url();

		$this->load->view('default', $data);
	}

	public function default_template_2($data) {
		$this->load->view('default2', $data);
	}

	public function one_col($data) {
		$this->load->view('one_col', $data);
	}

	public function two_col($data) {
		$this->load->view('two_col', $data);
	}

	public function admin($data) {
		$this->load->view('admin', $data);
	}

	public function ifram($data) {
		$data = "";
		$this->load->view('privacystatement', $data);
	}

}

?>